/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Framework;

import java.io.IOException;
import java.util.Hashtable;
import javax.microedition.lcdui.Image;

/**
 *
 * @author WanbooUIT
 */
public class CImageLoader 
{
 private static Hashtable pool = new Hashtable();

    public static Image getImage(String source)
    {
        if(pool.get(source) != null) return (Image) pool.get(source);
        try {
            Image temp = Image.createImage(source);
            pool.put(source, temp);
            return temp;
        } catch (IOException e){
            System.err.println("Error when loader image : "+source+": "+e.getMessage());
        }
        return null;
    }   
}
